class Figure{
	double dim1, dim2;
	Figure(double a, double b){
		this.dim1 = a;
		this.dim2 = b;
	}
	double area(){
		System.out.println("Area of figure is undefined");
		return 0;
	}
}
class Rectangle extends Figure {
	Rectangle( double a, double b){
		super(a,b);
	}
	double area(){
		System.out.println("Inside Area of Rectangle: ");
		return dim1*dim2;
	}
}
class Triangle extends Figure {
	Triangle (double a, double b){
		super(a, b);
	}
	double area(){
		System.out.println("Inside Area of Traingle: ");
		return (dim1*dim2)/2;
	}
}
public class FindAreas {
	public static void main(String[] args){
		Figure f = new Figure (1,2);
		Rectangle r = new Rectangle(2,3);
		Triangle t = new Triangle(3,4);
		
		Figure figure;
		figure = f;
		System.out.println(figure.area());
		
		figure = r;
		System.out.println(figure.area());
		
		figure = t;
		System.out.println(figure.area());
		
	}
}
